<!--
 * @Author: Xujianchen
 * @Date: 2024-08-13 09:46:56
 * @LastEditors: Xujianchen
 * @LastEditTime: 2024-08-13 11:17:32
 * @Description: 滑动验证
-->
<template>
  <Wrapper>
    <el-card shadow="never">
      <el-button
        type="primary"
        style="margin-bottom: 12px"
        @click="verifyVisible = true"
        >打开验证</el-button
      >
      <slide-verify
        :show="verifyVisible"
        type="inside"
        @success="onSuccess"
        @fail="onFail"
        @close="onClose"
      />
    </el-card>
  </Wrapper>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import SlideVerify from 'vue3-puzzle-vcode'

const verifyVisible = ref(false)

function onSuccess() {
  console.log('验证成功')
  ElMessage.success('验证成功')
  verifyVisible.value = false
}

function onFail() {
  console.log('验证失败')
  ElMessage.error('验证失败')
}

function onClose() {
  console.log('验证关闭')
  verifyVisible.value = false
}
</script>
